<?php
	require "../controller/admin.php";
?>

<!DOCTYPEhtml>
<html>
	<head>
		<title>
				Candy Shop
			</title>
			<link href="../style/adm.css" rel="stylesheet" type="text/css" />
			<meta http-equiv="content-type" content="text/html"; charset="utf-8">
		</head>
	<body>
		<div  id="container">
			<header>
				<p>Hallo  <?php echo $_SESSION['login'].'&nbsp'; ?></p>
				<a href="../controller/out.php">
					(Exit)
				</a>
					<form name="srch_form" action="#" method="POST">
						<input type="text" name="srch_itm"/>
						<input type="submit" name="srch" value="Search"/>
					</form>
			</header>
			<div class="content">
				<form name="item_form" action="adm_panel.php?sort=<?php echo $ord; ?>" method="POST">						<!-- Category Filter	-->
					<select name="c" onchange="this.form.submit();">
						<?php echo $catFilter; ?>
					</select>
				</form>
				<form name="addProdForm" action="adm_panel.php" method="POST" enctype="multipart/form-data">				<!--  Product Form   -->
					<table>
					<?php foreach($frm as $v){
							echo $v;
						} ?>
					<tr>
						<td colspan="2" style= "text-align:left;">
							<input type="file" name="file"  style="width:290px;" />
						</td>
					</tr>
					<tr>
						<td style= "text-align:left;">
							<input type="submit" name="addProduct" value="Save Product" />
						</td>
					</tr>
					</table>
				</form>
			</div>
			<aside>
				<div class="filters">
					<form action="adm_panel.php?cf=<?php echo $cf; ?>" name="filter-form" method="POST">						<!-- order filter -->
						<select name="sort" onchange="this.form.submit();">
							<?php echo $filtr; ?>
						</select>
					</form>
				</div>
				<div>
					<table>
						<thead>
							<tr>
								<td><b>ID</b></td>
								<td><b>Title</b></td>
								<td><b>Category</b></td>
								<td><b>Delete</b></td>
							</tr>
						</thead>
						<tbody>
							<?php $i=0;
							foreach($all as $value){ ?>
							<?php if ($i % 2 == 0){?>
								<tr class="even"> <?php }
								else{ ?> <tr>
								<?php ;} ?>
								<td><?php echo $value['id'];?></td>
								<td><a href = "<?php echo'?q='.$value['id'].'&c='.$value['category']; ?>"><?php echo $value['title'];?></a></td>
								<td><?php echo $value['cat_string'];?></td>
								<td><a href="?del=<?php echo $value['id']; ?>"><img src="../../img/bin/fileclose.png" height="16" width="16"/></a></td>
							</tr>
							<?php $i++;} ?>
						</tbody>
					</table>
				</div>
			</aside>
		</div>
	</body>
</html>